package com.bwie.filter;

import com.bwie.common.domain.Organization;
import com.bwie.controller.OrganizationController;
import com.bwie.mapper.OrganizationMapper;
import com.google.common.hash.BloomFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @className: OrganizationFilter
 * @Description: TODO
 * @version: v1.８.0
 * @author: 汪菲阳
 * @date: 2025/10/22 12:11
 */
@Component
public class OrganizationFilter implements ApplicationRunner {
    @Autowired
    private BloomFilter<String> bloomFilter;
    @Autowired
    private OrganizationMapper organizationMapper;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //查询所有的组织
        List<Organization> orangAll=organizationMapper.selectALLOrange();
        //遍历集合
        orangAll.forEach(organization -> {
            //获取组织
            String organizationName = organization.getOrganizationName();
            //存放进布隆过滤器
            bloomFilter.put(organizationName);
        });
    }
}
